using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PS_BAL_CUSTMap : EntityTypeConfiguration<SO_PS_BAL_CUST>
    {
        public SO_PS_BAL_CUSTMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Document_id, t.Invoice_Number, t.DATE, t.currency__, t.Invoice_Currency, t.currency });

            // Properties
            this.Property(t => t.Invoice_Number)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.Customer__)
                .HasMaxLength(6);

            this.Property(t => t.Customer)
                .HasMaxLength(80);

            this.Property(t => t.currency__)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Salesman)
                .HasMaxLength(30);

            this.Property(t => t.Invoice_Currency)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.currency)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("SO_PS_BAL_CUST");
            this.Property(t => t.Document_id).HasColumnName("Document_id");
            this.Property(t => t.Invoice_Number).HasColumnName("Invoice_Number");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.closed).HasColumnName("closed");
            this.Property(t => t.Customer__).HasColumnName("Customer_#");
            this.Property(t => t.Customer).HasColumnName("Customer");
            this.Property(t => t.currency__).HasColumnName("currency_#");
            this.Property(t => t.Salesman).HasColumnName("Salesman");
            this.Property(t => t.Invoice_Currency).HasColumnName("Invoice_Currency");
            this.Property(t => t.currency).HasColumnName("currency");
            this.Property(t => t.Customer_Amount).HasColumnName("Customer_Amount");
            this.Property(t => t.Customer_Balance).HasColumnName("Customer_Balance");
        }
    }
}
